#include "bflb_mtimer.h"        //mtimer定时器头文件
#include "bflb_pwm_v2.h"      //pwm_v2头文件
#include "bflb_clock.h"           //系统时钟头文件
#include "board.h"                 //开发板头文件，包装的库
#include "bflb_gpio.h"           //gpio头文件
#include "bflb_servo.h"


int main(void)
{
    // int i;
    board_init(); //板子初始化
    struct bflb_servo_attr servo = bflb_servo_attach(GPIO_PIN_19, PWM_CH3); // 舵机初始化，此处只使用了正向通道，GPIO的正向通道可以从附件中查找

    bflb_servo_write(&servo, 0); 
    bflb_mtimer_delay_ms(1000);
    bflb_servo_write(&servo, 45);
    bflb_mtimer_delay_ms(1000);
    bflb_servo_write(&servo, 90);
    bflb_mtimer_delay_ms(1000);
    bflb_servo_write(&servo, 135);
    bflb_mtimer_delay_ms(1000);
    bflb_servo_write(&servo, 180);
    bflb_mtimer_delay_ms(1000);
    bflb_servo_stop(&servo);

    while (0) {
        // bflb_servo_write(&servo, 0);
        // bflb_mtimer_delay_ms(2000);
        // bflb_servo_write(&servo, 45);
        // bflb_mtimer_delay_ms(2000);
        // bflb_servo_write(&servo, 90);
        // bflb_mtimer_delay_ms(2000);
        // bflb_servo_write(&servo, 135);
        // bflb_mtimer_delay_ms(2000);
        // bflb_servo_write(&servo, 180);
        // bflb_mtimer_delay_ms(2000);
    }
	
}
